package conversion;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

import dataobjects.Message;

public class MessageToString {
	
	public static String convert(Message m){
		XStream xs = new XStream();
		return xs.toXML( m );
	}
	
	public static Message convertBack(String s){
		XStream xs = new XStream(new DomDriver());
		return (Message) xs.fromXML( s );
	}

	public static void main(String[] args){
		
		String converted = convert( new Message());
		System.out.println( converted);
		
		System.out.println( convertBack(converted));
		
	}
}

